/**
 * @author janet
 * @date 2015-4-16
 */
package net.oscorner.dao.commons;

import net.oscorner.commons.BaseDao;
import net.oscorner.commons.BaseEntity;
import net.oscorner.commons.ConstantUtil;


/**
 * @author janet
 * @date 2015-4-16 上午10:54:36
 * 
 */

public class CommonDaoImpl implements CommonDao{
	
	private BaseDao dao ;
	
	
	/* (non-Javadoc)
	 * @see net.oscorner.dao.commons.CommonDao#createNewEntity(net.oscorner.commons.BaseEntity)
	 */
	public BaseDao getDao() {
		return dao;
	}

	public void setDao(BaseDao dao) {
		this.dao = dao;
	}

	@Override
	public String createNewEntity(BaseEntity entity) {
		// TODO Auto-generated method stub
		entity.setSqlType(ConstantUtil.SQL_TYPE_CREATE);
		entity.save(dao);
		return null;
	}

	/* (non-Javadoc)
	 * @see net.oscorner.dao.commons.CommonDao#updateEntity(net.oscorner.commons.BaseEntity)
	 */
	@Override
	public String updateEntity(BaseEntity entity) {
		// TODO Auto-generated method stub
		entity.setSqlType(ConstantUtil.SQL_TYPE_UPDATE);
		entity.save(dao);
		return null;
	}

	/* (non-Javadoc)
	 * @see net.oscorner.dao.commons.CommonDao#deleteEntity(net.oscorner.commons.BaseEntity)
	 */
	@Override
	public String deleteEntity(BaseEntity entity) {
		// TODO Auto-generated method stub
		entity.setSqlType(ConstantUtil.SQL_TYPE_DELETE);
		entity.save(dao);
		return null;
	}

}
